/**
 * @projectName: com.xiayuanxing.designPattern
 * @className: HouseDirector
 * @author: xiayuanxing
 * @description: 指挥者（构建一个使用build接口的对象）
 * @date: 2021/12/20 10:27
 * @version: 1.0
 */
public class HouseDirector {

    HouseBuilder houseBuilder = null;

    //构造器传入houseBuilder
    public HouseDirector(HouseBuilder houseBuilder){
        this.houseBuilder = houseBuilder;
    }

    //通过setter传入houseBuilder
    public void setHouseBuilder(HouseBuilder houseBuilder){
        this.houseBuilder = houseBuilder;
    }


    //如何处理建造房子的流程，交给指挥者
    public House constructHouse(){
        houseBuilder.buildBasic();
        houseBuilder.buildWalls();
        houseBuilder.roofed();
        return houseBuilder.buildHouse();
    }
}
